<?php
// Include Editor CSS, BBCode and Live Preview Javascript
$output = '<link rel="stylesheet" type="text/css" href="templates/common/bbcode.css" title="Default" />
<script language="JavaScript" src="media/javascript/bbcode.js" type="text/javascript"></script>
<script language="JavaScript" src="media/javascript/live_preview.js" type="text/javascript"></script>';

if ($this->config['text_editor_preview']) $live_preview_id = $id.'_preview';
else $live_preview_id = NULL;

$output .=	'
	<img class="bbcode_button" src="media/bbcode/bold.png" alt="Bold" title="Bold" onclick="addBBcode(\''.$id.'\', \''.$live_preview_id.'\', \'b\')" onmouseover="helpBox(\''.$id.'\', \'b\')" onmouseout="helpBox(\''.$id.'\', \'default\')" />
	<img class="bbcode_button" src="media/bbcode/italic.png" alt="Italic" title="Italic" onclick="addBBcode(\''.$id.'\', \''.$live_preview_id.'\', \'i\')" onmouseover="helpBox(\''.$id.'\', \'i\')" onmouseout="helpBox(\''.$id.'\', \'default\')" />
	<img class="bbcode_button" src="media/bbcode/underline.png" alt="Underline" title="Underline" onclick="addBBcode(\''.$id.'\', \''.$live_preview_id.'\', \'u\')" onmouseover="helpBox(\''.$id.'\', \'u\')" onmouseout="helpBox(\''.$id.'\', \'default\')" />
	<img src="media/bbcode/blackdot.gif" width="1" height="15" alt="|" />
	<img class="bbcode_button" src="media/bbcode/align_left.png" alt="Left Align" title="Left Align" onclick="addBBcode(\''.$id.'\', \''.$live_preview_id.'\', \'align=left\', \'align\')" onmouseover="helpBox(\''.$id.'\', \'align_left\')" onmouseout="helpBox(\''.$id.'\', \'default\')" />
	<img class="bbcode_button" src="media/bbcode/align_centre.png" alt="Centre Align" title="Centre Align" onclick="addBBcode(\''.$id.'\', \''.$live_preview_id.'\', \'align=center\', \'align\')" onmouseover="helpBox(\''.$id.'\', \'align_center\')" onmouseout="helpBox(\''.$id.'\', \'default\')" />
	<img class="bbcode_button" src="media/bbcode/align_right.png" alt="Right Align" title="Right Align" onclick="addBBcode(\''.$id.'\', \''.$live_preview_id.'\', \'align=right\', \'align\')" onmouseover="helpBox(\''.$id.'\', \'align_right\')" onmouseout="helpBox(\''.$id.'\', \'default\')" />
	<img src="media/bbcode/blackdot.gif" width="1" height="15" alt="|" />
	<img class="bbcode_button" src="media/bbcode/hyperlink.png" alt="Hyperlink" title="Hyperlink" onclick="addBBcode(\''.$id.'\', \''.$live_preview_id.'\', \'url\')" onmouseover="helpBox(\''.$id.'\', \'url\')" onmouseout="helpBox(\''.$id.'\', \'default\')" />
	<img class="bbcode_button" src="media/bbcode/image.png" alt="Image" title="Image" onclick="addBBcode(\''.$id.'\', \''.$live_preview_id.'\', \'img\')" onmouseover="helpBox(\''.$id.'\', \'img\')" onmouseout="helpBox(\''.$id.'\', \'default\')" />
	<img class="bbcode_button" src="media/bbcode/email.png" alt="Email" title="Email" onclick="addBBcode(\''.$id.'\', \''.$live_preview_id.'\', \'email\')" onmouseover="helpBox(\''.$id.'\', \'email\')" onmouseout="helpBox(\''.$id.'\', \'default\')" />
	<img src="media/bbcode/blackdot.gif" width="1" height="15" alt="|" />
	<img class="bbcode_button" src="media/bbcode/quote.gif" alt="Quote" title="Quote" onclick="addBBcode(\''.$id.'\', \''.$live_preview_id.'\', \'quote\')" onmouseover="helpBox(\''.$id.'\', \'quote\')" onmouseout="helpBox(\''.$id.'\', \'default\')" />
	<img class="bbcode_button" src="media/bbcode/code.gif" alt="Code" title="Code" onclick="addBBcode(\''.$id.'\', \''.$live_preview_id.'\', \'code\')" onmouseover="helpBox(\''.$id.'\', \'code\')" onmouseout="helpBox(\''.$id.'\', \'default\')" />
	<img src="media/bbcode/blackdot.gif" width="1" height="15" alt="|" />
	<img class="bbcode_button" src="media/bbcode/horizontalrule.png" alt="Horizontal Rule" title="Horizontal Rule" onclick="addBBcode(\''.$id.'\', \''.$live_preview_id.'\', \'hr\', \'none\')" onmouseover="helpBox(\''.$id.'\', \'hr\')" onmouseout="helpBox(\''.$id.'\', \'default\')" />
	<img class="bbcode_button" src="media/bbcode/indent.png" alt="Indent" title="Indent" onclick="addBBcode(\''.$id.'\', \''.$live_preview_id.'\', \'indent\')" onmouseover="helpBox(\''.$id.'\', \'indent\')" onmouseout="helpBox(\''.$id.'\', \'default\')" />
	<img class="bbcode_button" src="media/bbcode/html.png" alt="HTML" title="HTML" onclick="addBBcode(\''.$id.'\', \''.$live_preview_id.'\', \'html\')" onmouseover="helpBox(\''.$id.'\', \'html\')" onmouseout="helpBox(\''.$id.'\', \'default\')" />
	<img src="media/bbcode/blackdot.gif" width="1" height="15" alt="|" />
	<img class="bbcode_button" src="media/bbcode/colour.png" alt="Font Colour" title="Font Colour" />
	<select onmouseover="helpBox(\''.$id.'\', \'colour\')" onfocus="this.className=\'select_focus\'" onblur="this.className=\'select\'" onmouseout="helpBox(\''.$id.'\', \'default\')">
		<option selected="selected">Color</option>
		<option style="color:#FFF; background-color: grey;" onclick="addBBcode(\''.$id.'\', \''.$live_preview_id.'\', \'colour=grey\', \'colour\')">Grey</option>
		<option style="color:#FFF; background-color: red;" onclick="addBBcode(\''.$id.'\', \''.$live_preview_id.'\', \'colour=red\', \'colour\')">Red</option>
		<option style="color:#FFF; background-color: blue;" onclick="addBBcode(\''.$id.'\', \''.$live_preview_id.'\', \'colour=blue\', \'colour\')">Blue</option>
		<option style="color:#FFF; background-color: green;" onclick="addBBcode(\''.$id.'\', \''.$live_preview_id.'\', \'colour=green\', \'colour\')">Green</option>
		<option style="color:#FFF; background-color: orange;" onclick="addBBcode(\''.$id.'\', \''.$live_preview_id.'\', \'colour=orange\', \'colour\')">Orange</option>
	</select>
	<img class="bbcode_button" src="media/bbcode/heading_1.png" alt="Heading Style" title="Heading Style" />
	<select onmouseover="helpBox(\''.$id.'\', \'heading\')" onfocus="this.className=\'select_focus\'" onblur="this.className=\'select\'" onmouseout="helpBox(\''.$id.'\', \'default\')">
		<option >Heading</option>
		<option onclick="addBBcode(\''.$id.'\', \''.$live_preview_id.'\', \'h1\', \'h1\')">Heading 1</option>
		<option onclick="addBBcode(\''.$id.'\', \''.$live_preview_id.'\', \'h2\', \'h2\')">Heading 2</option>
		<option onclick="addBBcode(\''.$id.'\', \''.$live_preview_id.'\', \'h3\', \'h3\')">Heading 3</option>
	</select>

<div style="width: 99%"><div>
<div class="helpbox" style="width:'.$width_percent.'%" id="'.$id.'_helpbox">Helpbox - Hover over a button above for a description</div>
</div></div>';

if ($this->config['text_editor_preview']) {
	$live_preview_id_js = ' onselect="storeCaret(this); previewParse(\''.$id.'\', \''.$live_preview_id.'\');"
		onclick="storeCaret(this); previewParse(\''.$id.'\', \''.$live_preview_id.'\');"
		onkeyup="storeCaret(this); previewParse(\''.$id.'\', \''.$live_preview_id.'\');"';
}
$output .= '
	<div style="width: 99%"><div>
	<textarea name="'.$this->form_id.'['.$id.']" id="'.$id.'" style="width:'.$width_percent.'%; height:'.$height_pixels.'px"'.@$live_preview_id_js.' onfocus="this.className=\'textarea_focus\'" onblur="this.className=\'textarea\'" rows="0" cols="0">'.$value.'</textarea>
	</div></div>';
if ($this->config['text_editor_preview']) $output .= '<div id="'.$live_preview_id.'_toggle" style="cursor:pointer">'.$this->icon['show_hide'].'</a> <b>'.$name.' Preview:</b></div>
	<div id="'.$live_preview_id.'" class="live_preview" style="width:'.$width_percent.'%; height:'.$height_pixels.'px"></div>
	<script type="text/javascript">
			$(document).ready(function() {
				$(\'#'.$live_preview_id.'\').hide();
			});

			$(\'#'.$live_preview_id.'_toggle\').click(function() {
				$(\'#'.$live_preview_id.'\').slideToggle();
			});
		</script>';

return $output;
?>